#define  _CRT_SECURE_NO_WARNINGS
#include "stdio.h"
int main()
{
	int T = 0, i = 0, L = 0, R = 0;
	int sum = 0;

	scanf("%d\n", &T);
	for (i = 0; i < T; i++)
	{
		scanf("%d %d", &L, &R);
	}

	if (L != R)
	{

		for (L; L <= R; L++)
		{
			sum = sum + L;
		}
	}
	if (sum % 3 == 0)
		printf("YES");
	else
		printf("NO");
	
	return 0;
}